package pay

import (
	"gitee.com/liuxuezhan/ar-platform/admin-api/internal/pay/base"
	"gitee.com/liuxuezhan/ar-platform/admin-api/internal/pay/bcpay"
	"gitee.com/liuxuezhan/ar-platform/admin-api/internal/pay/bgw"
	"gitee.com/liuxuezhan/ar-platform/admin-api/internal/pay/bpay"
	"gitee.com/liuxuezhan/ar-platform/admin-api/internal/pay/bspay"
	"gitee.com/liuxuezhan/ar-platform/admin-api/internal/pay/easypay"
	"gitee.com/liuxuezhan/ar-platform/admin-api/internal/pay/payfun"
	"gitee.com/liuxuezhan/ar-platform/admin-api/internal/pay/paythere"
	"gitee.com/liuxuezhan/ar-platform/admin-api/internal/pay/qqhfpay"
	"gitee.com/liuxuezhan/ar-platform/admin-api/internal/pay/sojupay"
	"gitee.com/liuxuezhan/ar-platform/admin-api/internal/pay/stanpayng"
	"gitee.com/liuxuezhan/ar-platform/admin-api/internal/pay/starpay"
	"gitee.com/liuxuezhan/ar-platform/admin-api/internal/pay/tbpay"
	"gitee.com/liuxuezhan/ar-platform/admin-api/internal/pay/uzpay"
)

// PayFactory 支付工厂接口
type PayFactory interface {
	CreatePay(config base.Config) base.Payment
}

func NewFactory(config base.Config) base.Payment {
	var factory PayFactory
	switch config.MappingCode {
	case "BCPAY", "bcpay":
		factory = &bcpay.Factory{}
	case "TBPAY", "tbpay":
		factory = &tbpay.Factory{}
	case "PAYFUN", "payfun":
		factory = &payfun.Factory{}
	case "SOJUPAY", "sojupay":
		factory = &sojupay.Factory{}
	case "STARPAY", "starpay":
		factory = &starpay.Factory{}
	case "EASYPAY", "easypay":
		factory = &easypay.Factory{}
	case "QQHFPAY", "qqhfpay":
		factory = &qqhfpay.Factory{}
	case "BPAY", "bpay":
		factory = &bpay.Factory{}
	case "stanNgPay":
		factory = &stanpayng.Factory{}
	case "PAYTHERE", "paythere":
		factory = &paythere.Factory{}
	case "UZPAY", "uzpay":
		factory = &uzpay.Factory{}
	case "BSPAY", "bspay":
		factory = &bspay.Factory{}
	case "bgw", "BGW":
		factory = &bgw.Factory{}
	default:
		return nil
	}
	return factory.CreatePay(config)
}
